APPNAME = AppWeather
CC = g++

CFLAGS	= -O0 -Wall -fPIC `sdl-config --cflags`

LIBS	=	-lOpenNI 	\
		-lXnVNite 	\
		-lGL 		\
		-lGLU 		\
		-lglut		\
		-lboost_serialization-mt -lboost_filesystem \
		-lcurl -ltinyxml \
		`sdl-config --libs` -lSDL_image -lSDL_ttf

INCLUDE_PATH =	-I/usr/include/nite/	\
		-I/usr/include/ni/	\
		-I../../View/UI		\
		-I../

EXEC	= $(APPNAME).so

BUILDDIR = ../../build/

OUTPUTDIR = ../../../app/

DEFINE	= -DDEBUG

PREBUILD =  App.o UIComposite.o UIEngine.o UIImage.o UIJPGImage.o UILeaf.o UIPNGImage.o UIText.o UIWindow.o

GENERAL_APP_SUFIX = .o Action.o Model.o Preferences.o View.o

OBJECTS = Weather.o $(PREBUILD) $(addprefix $(APPNAME),$(GENERAL_APP_SUFIX))

DEPEND = $(addprefix $(BUILDDIR),$(OBJECTS))  $(addprefix $(OUTPUTDIR),$(EXEC)) 

all: $(DEPEND)

$(OUTPUTDIR)%.so:  $(addprefix $(BUILDDIR),$(OBJECTS))
	$(CC) $(addprefix $(BUILDDIR),$(OBJECTS)) $(DEFINE) $(LIBS) -Wl,-soname,$@.1 -shared -o $@

$(BUILDDIR)%.o:%.cpp
	$(CC) -o $@ -c $^ $(DEFINE) $(INCLUDE_PATH) $(CFLAGS)

clean:
	rm -f $(BUILDDIR)*.o $(addprefix $(OUTPUTDIR),$(EXEC))